export default class Watcher {
    constructor() {
        //观察者数组
        this.WatcherList = []
        this.watchers = null
    }
    addWatcher(item) {
        //添加观察者
        this.WatcherList.push({ ...item, watchers: this.watchers })
    }
    triggerWatcher(target, key, value,) {
        //通知观察者更新
        this.WatcherList.map(item => {
            if (item.target === target&&item.key === key) {
                item.watchers.event.updata(value)
            }
        })
    }
}